<p>This rule is deprecated, and will eventually be removed.</p>
<p>Using command line arguments is security-sensitive. It has led in the past to the following vulnerabilities:</p>
<ul>
  <li> <a href="https://www.cve.org/CVERecord?id=CVE-2018-7281">CVE-2018-7281</a> </li>
  <li> <a href="https://www.cve.org/CVERecord?id=CVE-2018-12326">CVE-2018-12326</a> </li>
  <li> <a href="https://www.cve.org/CVERecord?id=CVE-2011-3198">CVE-2011-3198</a> </li>
</ul>
<p>Command line arguments can be dangerous just like any other user input. They should never be used without being first validated and sanitized.</p>
<p>Remember also that any user can retrieve the list of processes running on a system, which makes the arguments provided to them visible. Thus
passing sensitive information via command line arguments should be considered as insecure.</p>
<p>This rule raises an issue when on every program entry points (<code>main</code> methods) when command line arguments are used. The goal is to guide
security code reviews.</p>
<h2>Ask Yourself Whether</h2>
<ul>
  <li> any of the command line arguments are used without being sanitized first. </li>
  <li> your application accepts sensitive information via command line arguments. </li>
</ul>
<p>If you answered yes to any of these questions you are at risk.</p>
<h2>Recommended Secure Coding Practices</h2>
<p><a href="https://www.owasp.org/index.php/Input_Validation_Cheat_Sheet">Sanitize</a> all command line arguments before using them.</p>
<p>Any user or application can list running processes and see the command line arguments they were started with. There are safer ways of providing
sensitive information to an application than exposing them in the command line. It is common to write them on the process' standard input, or give the
path to a file containing the information.</p>
<h2>Sensitive Code Example</h2>
<pre>
// The process object is a global that provides information about, and control over, the current Node.js process
var param = process.argv[2]; // Sensitive: check how the argument is used
console.log('Param: ' + param);
</pre>
<h2>See</h2>
<ul>
  <li> OWASP - <a href="https://owasp.org/www-project-top-ten/2017/A1_2017-Injection">Top 10 2017 Category A1 - Injection</a> </li>
  <li> CWE - <a href="https://cwe.mitre.org/data/definitions/88">CWE-88 - Argument Injection or Modification</a> </li>
  <li> CWE - <a href="https://cwe.mitre.org/data/definitions/214">CWE-214 - Information Exposure Through Process Environment</a> </li>
</ul>
